package com.innjia.base.common;

import java.util.ResourceBundle;

public class ZimaConfig {

	private static ResourceBundle rb = ResourceBundle.getBundle("conf/zhimaconfig");
	
	public static String gatewayUrl = "https://zmopenapi.zmxy.com.cn/sandbox.do";
	
//	public static String format = "JSON";
	
	public static String charset = "UTF-8";
	
	public static String signType = "RSA2";
	
	//public static String sign = "";
	
//	public static String version = "1.0";
	
//	public static String prouductCode = "w1010100000000002978";
	
	public static String privateKey;
	
	public static String zimaPublicKey;
	
	public static String appId;
	
	//房东签约回调地址
	public static String returnUrlLandlord;
	
	public static String returnUrlRenter;
	
//	public static String timestamp = "";
	
//	public static String method = "";

//	public static String bizContent = "";
	
	static {
		gatewayUrl = rb.getString("GATE_WAY_URL");
		appId = rb.getString("APP_ID");
		privateKey = rb.getString("PRIVATE_KEY");
		zimaPublicKey =  rb.getString("ZIMA_PUBLIC_KEY");
		returnUrlLandlord = rb.getString("RETURN_URL_LANDLORD");
		returnUrlRenter = rb.getString("RETURN_URL_RENTER");
	}
	
	/**
	 * 认证类型枚举 
	 */
	public enum SignBizCodeEnum {
		
		FACE("CERT_INFO", "人脸认证"), E_SIGN("E_SIGN_INFO", "签名认证");
		
		private String identityType;
		
		private String desc;

		private SignBizCodeEnum(String identityType, String desc) {
			this.identityType = identityType;
			this.desc = desc;
		}

		public String getIdentityType() {
			return identityType;
		}

		public void setIdentityType(String identityType) {
			this.identityType = identityType;
		}

		public String getDesc() {
			return desc;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}
		
		public static String getIdentityTypeByName(String name) {
			for(SignBizCodeEnum e : values()) {
				if(e.name().equals(name)) {
					return e.getIdentityType();
				}
			}
			return null;
		}
	}
	
	/*
	 * 签名附近关键字
	 */
	public enum SignPosKeywordEnum {
		
		PARTY_A("甲方签名"), PARTY_B("乙方签名");
		
		private String keyword;

		private SignPosKeywordEnum(String keyword) {
			this.keyword = keyword;
		}

		public String getKeyword() {
			return keyword;
		}

		public void setKeyword(String keyword) {
			this.keyword = keyword;
		}
		
		public static String getkeyWordByName(String name) {
			for(SignPosKeywordEnum e : values()) {
				if(e.name().equals(name)) {
					return e.getKeyword();
				}
			}
			return null;
		}
	}
}
